home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Sound / AHI / Developer / include / C / devices / ahi.h
C/C++ Source or Header  |  1997-04-27  |  14KB  |  400 lines

  1. #ifndef DEVICES_AHI_H
  2. #define DEVICES_AHI_H
  3.  
  4. /*
  5. **    $VER: ahi.h 4.2 (27.4.97)
  6. **
  7. **    ahi.device definitions
  8. **
  9. **    (C) Copyright 1994-1997 Martin Blom
  10. **    All Rights Reserved.
  11. **
  12. ** (TAB SIZE: 8)
  13. */
  14.  
  15. /*****************************************************************************/
  16.  
  17. #ifndef EXEC_TYPES_H
  18. #include <exec/types.h>
  19. #endif
  20.  
  21. #ifndef EXEC_IO_H
  22. #include <exec/io.h>
  23. #endif
  24.  
  25. #ifndef UTILITY_TAGITEM_H
  26. #include <utility/tagitem.h>
  27. #endif
  28.  
  29. #ifndef LIBRARIES_IFFPARSE_H
  30. #include <libraries/iffparse.h>
  31. #endif
  32.  
  33. /*****************************************************************************/
  34.  
  35. #ifndef EIGHTSVX_H                 /* Do not define Fixed twice */
  36.  
  37. typedef LONG    Fixed;                /* A fixed-point value, 16 bits
  38.                            to the left of the point and
  39.                            16 bits to the right */
  40. #endif
  41. typedef Fixed    sposition;
  42.  
  43. /*** STRUCTURES */
  44.  
  45.  /* AHIAudioCtrl */
  46. struct AHIAudioCtrl
  47. {
  48.     APTR    ahiac_UserData;
  49.     /* Lots of private data follows! */
  50. };
  51.  
  52.  /* AHISoundMessage */
  53. struct AHISoundMessage
  54. {
  55.      UWORD    ahism_Channel;
  56. };
  57.  
  58.  /* AHIRecordMessage */
  59. struct AHIRecordMessage
  60. {
  61.     ULONG    ahirm_Type;            /* Format of buffer (object) */
  62.     APTR    ahirm_Buffer;            /* Pointer to the sample array */
  63.     ULONG    ahirm_Length;            /* Number of sample frames in buffer */
  64. };
  65.  
  66.  /* AHISampleInfo */
  67. struct AHISampleInfo
  68. {
  69.     ULONG    ahisi_Type;            /* Format of samples */
  70.     APTR    ahisi_Address;            /* Address to array of samples */
  71.     ULONG    ahisi_Length;            /* Number of samples in array */
  72. };
  73.  
  74.  
  75.  /* AHIAudioModeRequester */
  76. struct AHIAudioModeRequester
  77. {
  78.     ULONG    ahiam_AudioID;            /* Selected audio mode */
  79.     ULONG    ahiam_MixFreq;            /* Selected mixing/sampling frequency */
  80.     
  81.     WORD    ahiam_LeftEdge;            /* Coordinates of requester on exit */
  82.     WORD    ahiam_TopEdge;
  83.     WORD    ahiam_Width;
  84.     WORD    ahiam_Height;
  85.  
  86.     BOOL    ahiam_InfoOpened;        /* Info window opened on exit? */
  87.     WORD    ahiam_InfoLeftEdge;        /* Last coordinates of Info window */
  88.     WORD    ahiam_InfoTopEdge;
  89.     WORD    ahiam_InfoWidth;
  90.     WORD    ahiam_InfoHeight;
  91.  
  92.     APTR    ahiam_UserData;            /* You can store your own data here */
  93.     /* Lots of private data follows! */
  94. };
  95.  
  96.  /* AHIEffMasterVolume */
  97. struct AHIEffMasterVolume
  98. {
  99.     ULONG    ahie_Effect;            /* Set to AHIET_MASTERVOLUME */
  100.     Fixed    ahiemv_Volume;            /* See autodocs for range! */
  101. };
  102.  
  103.  /* AHIEffOutputBuffer */
  104. struct AHIEffOutputBuffer
  105. {
  106.     ULONG         ahie_Effect;        /* Set to AHIET_OUTPUTBUFFER */
  107.     struct Hook    *ahieob_Func;
  108.  /* These fields are filled by AHI */
  109.     ULONG         ahieob_Type;        /* Format of buffer */
  110.     APTR         ahieob_Buffer;        /* Pointer to the sample array */
  111.     ULONG         ahieob_Length;        /* Number of sample frames in buffer */
  112. };
  113.  
  114.  /* AHIEffDSPMask (V4) */
  115. struct AHIEffDSPMask
  116. {
  117.     ULONG    ahie_Effect;            /* Set to AHIET_DSPMASK */
  118.     UWORD    ahiedm_Channels;        /* Number of elements in array */
  119.     UBYTE    ahiedm_Mask[0];            /* Here follows the array */
  120. };
  121.  
  122. #define AHIEDM_WET        (0)
  123. #define AHIEDM_DRY        (1)
  124.  
  125.  /* AHIEffDSPEcho (V4) */
  126. struct AHIDSPEcho
  127. {
  128.     ULONG    ahie_Effect;            /* Set to AHIET_DSPECHO */
  129.     ULONG    ahiede_Delay;            /* In samples */
  130.     Fixed    ahiede_Feedback;
  131.     Fixed    ahiede_Mix;
  132.     Fixed    ahiede_Cross;
  133. };
  134.  
  135.  /* AHIEffChannelInfo (V4) */
  136.  
  137. struct AHIEffChannelInfo
  138. {
  139.     ULONG         ahie_Effect;        /* Set to AHIET_CHANNELINFO */
  140.     struct Hook    *ahieci_Func;
  141.     UWORD         ahieci_Channels;
  142.     UWORD         ahieci_Pad;
  143.  /* The rest is filled by AHI */
  144.      ULONG         ahieci_Offset[0];    /* The array follows */
  145. };
  146.  
  147. /*** TAGS */
  148.  
  149. #define AHI_TagBase        (TAG_USER)
  150. #define AHI_TagBaseR        (AHI_TagBase|0x8000)
  151.  
  152.  /* AHI_AllocAudioA tags */
  153. #define AHIA_AudioID        (AHI_TagBase+1)        /* Desired audio mode */
  154. #define AHIA_MixFreq        (AHI_TagBase+2)        /* Suggested mixing frequency */
  155. #define AHIA_Channels        (AHI_TagBase+3)        /* Suggested number of channels */
  156. #define AHIA_Sounds        (AHI_TagBase+4)        /* Number of sounds to use */
  157. #define AHIA_SoundFunc        (AHI_TagBase+5)        /* End-of-Sound Hook */
  158. #define AHIA_PlayerFunc        (AHI_TagBase+6)        /* Player Hook */
  159. #define AHIA_PlayerFreq        (AHI_TagBase+7)        /* Frequency for player Hook (Fixed)*/
  160. #define AHIA_MinPlayerFreq    (AHI_TagBase+8)        /* Minimum Frequency for player Hook */
  161. #define AHIA_MaxPlayerFreq    (AHI_TagBase+9)        /* Maximum Frequency for player Hook */
  162. #define AHIA_RecordFunc        (AHI_TagBase+10)    /* Sample recording Hook */
  163. #define AHIA_UserData        (AHI_TagBase+11)    /* What to put in ahiac_UserData */
  164.  
  165.   /* AHI_PlayA tags (V4) */
  166. #define AHIP_BeginChannel    (AHI_TagBase+40)    /* All command tags should be... */
  167. #define AHIP_EndChannel        (AHI_TagBase+41)    /* ... enclosed by these tags. */
  168. #define AHIP_Freq        (AHI_TagBase+50)
  169. #define AHIP_Vol        (AHI_TagBase+51)
  170. #define AHIP_Pan        (AHI_TagBase+52)
  171. #define AHIP_Sound        (AHI_TagBase+53)
  172. #define AHIP_Offset        (AHI_TagBase+54)
  173. #define AHIP_Length        (AHI_TagBase+55)
  174. #define AHIP_LoopFreq        (AHI_TagBase+60)
  175. #define AHIP_LoopVol        (AHI_TagBase+61)
  176. #define AHIP_LoopPan        (AHI_TagBase+62)
  177. #define AHIP_LoopSound        (AHI_TagBase+63)
  178. #define AHIP_LoopOffset        (AHI_TagBase+64)
  179. #define AHIP_LoopLength        (AHI_TagBase+65)
  180.  
  181.  /* AHI_ControlAudioA tags */
  182. #define AHIC_Play        (AHI_TagBase+80)    /* Boolean */
  183. #define AHIC_Record        (AHI_TagBase+81)    /* Boolean */
  184. #define AHIC_MonitorVolume    (AHI_TagBase+82)
  185. #define AHIC_MonitorVolume_Query (AHI_TagBase+83)    /* ti_Data is pointer to Fixed (LONG) */
  186. #define AHIC_MixFreq_Query    (AHI_TagBase+84)    /* ti_Data is pointer to ULONG */
  187. /* --- New for V2, they will be ignored by V1 --- */
  188. #define AHIC_InputGain        (AHI_TagBase+85)
  189. #define AHIC_InputGain_Query    (AHI_TagBase+86)    /* ti_Data is pointer to Fixed (LONG) */
  190. #define AHIC_OutputVolume    (AHI_TagBase+87)
  191. #define AHIC_OutputVolume_Query    (AHI_TagBase+88)    /* ti_Data is pointer to Fixed (LONG) */
  192. #define AHIC_Input        (AHI_TagBase+89)
  193. #define AHIC_Input_Query    (AHI_TagBase+90)    /* ti_Data is pointer to ULONG */
  194. #define AHIC_Output        (AHI_TagBase+91)
  195. #define AHIC_Output_Query    (AHI_TagBase+92)    /* ti_Data is pointer to ULONG */
  196.  
  197.  /* AHI_GetAudioAttrsA tags */
  198. #define AHIDB_AudioID        (AHI_TagBase+100)
  199. #define AHIDB_Driver        (AHI_TagBaseR+101)    /* Pointer to name of driver */
  200. #define AHIDB_Flags        (AHI_TagBase+102)    /* Private! */
  201. #define AHIDB_Volume        (AHI_TagBase+103)    /* Boolean */
  202. #define AHIDB_Panning        (AHI_TagBase+104)    /* Boolean */
  203. #define AHIDB_Stereo        (AHI_TagBase+105)    /* Boolean */
  204. #define AHIDB_HiFi        (AHI_TagBase+106)    /* Boolean */
  205. #define AHIDB_PingPong        (AHI_TagBase+107)    /* Boolean */
  206. #define AHIDB_MultTable        (AHI_TagBase+108)    /* Private! */
  207. #define AHIDB_Name        (AHI_TagBaseR+109)    /* Pointer to name of this mode */
  208. #define AHIDB_Bits        (AHI_TagBase+110)    /* Output bits */
  209. #define AHIDB_MaxChannels    (AHI_TagBase+111)    /* Max supported channels */
  210. #define AHIDB_MinMixFreq    (AHI_TagBase+112)    /* Min mixing freq. supported */
  211. #define AHIDB_MaxMixFreq    (AHI_TagBase+113)    /* Max mixing freq. supported */
  212. #define AHIDB_Record        (AHI_TagBase+114)    /* Boolean */
  213. #define AHIDB_Frequencies    (AHI_TagBase+115)
  214. #define AHIDB_FrequencyArg    (AHI_TagBase+116)    /* ti_Data is frequency index */
  215. #define AHIDB_Frequency        (AHI_TagBase+117)
  216. #define AHIDB_Author        (AHI_TagBase+118)    /* Pointer to driver author name */
  217. #define AHIDB_Copyright        (AHI_TagBase+119)    /* Pointer to driver copyright notice */
  218. #define AHIDB_Version        (AHI_TagBase+120)    /* Pointer to driver version string */
  219. #define AHIDB_Annotation    (AHI_TagBase+121)    /* Pointer to driver annotation text */
  220. #define AHIDB_BufferLen        (AHI_TagBase+122)    /* Specifies the string buffer size */
  221. #define AHIDB_IndexArg        (AHI_TagBase+123)    /* ti_Data is frequency! */
  222. #define AHIDB_Index        (AHI_TagBase+124)
  223. #define AHIDB_Realtime        (AHI_TagBase+125)    /* Boolean */
  224. #define AHIDB_MaxPlaySamples    (AHI_TagBase+126)    /* It's sample *frames* */
  225. #define AHIDB_MaxRecordSamples    (AHI_TagBase+127)    /* It's sample *frames* */
  226. #define AHIDB_FullDuplex    (AHI_TagBase+129)    /* Boolean */
  227. /* --- New for V2, they will be ignored by V1 --- */
  228. #define AHIDB_MinMonitorVolume    (AHI_TagBase+130)
  229. #define AHIDB_MaxMonitorVolume    (AHI_TagBase+131)
  230. #define AHIDB_MinInputGain    (AHI_TagBase+132)
  231. #define AHIDB_MaxInputGain    (AHI_TagBase+133)
  232. #define AHIDB_MinOutputVolume    (AHI_TagBase+134)
  233. #define AHIDB_MaxOutputVolume    (AHI_TagBase+135)
  234. #define AHIDB_Inputs        (AHI_TagBase+136)
  235. #define AHIDB_InputArg        (AHI_TagBase+137)    /* ti_Data is input index */
  236. #define AHIDB_Input        (AHI_TagBase+138)
  237. #define AHIDB_Outputs        (AHI_TagBase+139)
  238. #define AHIDB_OutputArg        (AHI_TagBase+140)    /* ti_Data is input index */
  239. #define AHIDB_Output        (AHI_TagBase+141)
  240. /* --- New for V4, they will be ignored by V2 and earlier --- */
  241. #define AHIDB_Data        (AHI_TagBaseR+142)    /* Private! */
  242.  
  243.  /* AHI_BestAudioIDA tags */
  244. /* --- New for V4, they will be ignored by V2 and earlier --- */
  245. #define AHIB_Dizzy        (AHI_TagBase+190)
  246.  
  247.  /* AHI_AudioRequestA tags */
  248.     /* Window control */
  249. #define AHIR_Window        (AHI_TagBase+200)    /* Parent window */
  250. #define AHIR_Screen        (AHI_TagBase+201)    /* Screen to open on if no window */
  251. #define AHIR_PubScreenName    (AHI_TagBase+202)    /* Name of public screen */
  252. #define AHIR_PrivateIDCMP    (AHI_TagBase+203)    /* Allocate private IDCMP? */
  253. #define AHIR_IntuiMsgFunc    (AHI_TagBase+204)    /* Function to handle IntuiMessages */
  254. #define AHIR_SleepWindow    (AHI_TagBase+205)    /* Block input in AHIR_Window? */
  255. #define AHIR_UserData        (AHI_TagBase+206)    /* What to put in ahiam_UserData */
  256.     /* Text display */
  257. #define AHIR_TextAttr        (AHI_TagBase+220)    /* Text font to use for gadget text */
  258. #define AHIR_Locale        (AHI_TagBase+221)    /* Locale to use for text */
  259. #define AHIR_TitleText        (AHI_TagBase+222)    /* Title of requester */
  260. #define AHIR_PositiveText    (AHI_TagBase+223)    /* Positive gadget text */
  261. #define AHIR_NegativeText    (AHI_TagBase+224)    /* Negative gadget text */
  262.     /* Initial settings */
  263. #define AHIR_InitialLeftEdge    (AHI_TagBase+240)    /* Initial requester coordinates */
  264. #define AHIR_InitialTopEdge    (AHI_TagBase+241)
  265. #define AHIR_InitialWidth    (AHI_TagBase+242)    /* Initial requester dimensions */
  266. #define AHIR_InitialHeight    (AHI_TagBase+243)
  267. #define AHIR_InitialAudioID    (AHI_TagBase+244)    /* Initial audio mode id */
  268. #define AHIR_InitialMixFreq    (AHI_TagBase+245)    /* Initial mixing/sampling frequency */
  269. #define AHIR_InitialInfoOpened    (AHI_TagBase+246)    /* Info window initially opened? */
  270. #define AHIR_InitialInfoLeftEdge (AHI_TagBase+247)    /* Initial Info window coords. */
  271. #define AHIR_InitialInfoTopEdge (AHI_TagBase+248)
  272. #define AHIR_InitialInfoWidth    (AHI_TagBase+249)    /* Not used! */
  273. #define AHIR_InitialInfoHeight    (AHI_TagBase+250)    /* Not used! */
  274.     /* Options */
  275. #define AHIR_DoMixFreq        (AHI_TagBase+260)    /* Allow selection of mixing frequency? */
  276. #define AHIR_DoDefaultMode    (AHI_TagBase+261)    /* Allow selection of default mode? (V4) */
  277.     /* Filtering */
  278. #define AHIR_FilterTags        (AHI_TagBase+270)    /* Pointer to filter taglist */
  279. #define AHIR_FilterFunc        (AHI_TagBase+271)    /* Function to filter mode id's */
  280.  
  281. /*** DEFS */
  282.  
  283. #define AHINAME            "ahi.device"
  284. #define AHI_INVALID_ID        (~0)            /* Invalid Audio ID */
  285. #define AHI_DEFAULT_ID        (0x00000000)        /* Only for AHI_AllocAudioA()! */
  286. #define AHI_LOOPBACK_ID        (0x00000001)        /* Special sample render Audio ID */
  287. #define AHI_DEFAULT_FREQ    (0)            /* Only for AHI_AllocAudioA()! */
  288. #define AHI_MIXFREQ        (~0)            /* Special frequency for AHI_SetFreq() */
  289. #define AHI_NOSOUND        (0xffff)        /* Turns a channel off */
  290.  
  291.  /* Set#? Flags */
  292. #define AHISF_IMM        (1<<0)
  293. #define AHISB_IMM        (0)
  294.  
  295.  /* Effect Types */
  296. #define AHIET_CANCEL        (1<<31)            /* OR with effect to disable */
  297. #define AHIET_MASTERVOLUME    (1)
  298. #define AHIET_OUTPUTBUFFER    (2)
  299. /* --- New for V4 --- */
  300. #define AHIET_DSPMASK        (3)
  301. #define AHIET_DSPECHO        (4)
  302. #define AHIET_CHANNELINFO    (5)
  303.  
  304.  /* Sound Types */
  305. #define AHIST_NOTYPE        (~0)            /* Private */
  306. #define AHIST_SAMPLE        (0)            /* 8 or 16 bit sample */
  307. #define AHIST_DYNAMICSAMPLE    (1)            /* Dynamic sample */
  308. #define AHIST_INPUT        (1<<29)            /* The input from your sampler */
  309. #define AHIST_BW        (1<<30)            /* Private */
  310.  
  311.  /* Sample types */
  312. /* Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S
  313.    are supported by AHI_LoadSound(). */
  314. #define AHIST_M8S        (0)            /* Mono, 8 bit signed (BYTE) */
  315. #define AHIST_M16S        (1)            /* Mono, 16 bit signed (WORD) */
  316. #define AHIST_S8S        (2)            /* Stereo, 8 bit signed (2×BYTE) */
  317. #define AHIST_S16S        (3)            /* Stereo, 16 bit signed (2×WORD) */
  318. #define AHIST_M32S        (8)            /* Mono, 32 bit signed (LONG) */
  319. #define AHIST_S32S        (10)            /* Stereo, 32 bit signed (2×LONG) */
  320.  
  321. #define AHIST_M8U        (4)            /* OBSOLETE! */
  322.  
  323.  /* Error codes */
  324. #define AHIE_OK            (0)            /* No error */
  325. #define AHIE_NOMEM        (1)            /* Out of memory */
  326. #define AHIE_BADSOUNDTYPE    (2)            /* Unknown sound type */
  327. #define AHIE_BADSAMPLETYPE    (3)            /* Unknown/unsupported sample type */
  328. #define AHIE_ABORTED        (4)            /* User-triggered abortion */
  329. #define AHIE_UNKNOWN        (5)            /* Error, but unknown */
  330. #define AHIE_HALFDUPLEX        (6)            /* CMD_WRITE/CMD_READ failure */
  331.  
  332.  
  333.  
  334. /* DEVICE INTERFACE DEFINITIONS FOLLOWS ************************************/
  335.  
  336.  /* Device units */
  337.  
  338. #define AHI_DEFAULT_UNIT    (0)
  339. #define AHI_NO_UNIT        (255)
  340.  
  341.  
  342.  /* The preference file */
  343.  
  344. #define ID_AHIU MAKE_ID('A','H','I','U')
  345. #define ID_AHIG MAKE_ID('A','H','I','G')
  346.  
  347. struct AHIUnitPrefs
  348. {
  349.     UBYTE    ahiup_Unit;
  350.         UBYTE    ahiup_Pad;
  351.         UWORD    ahiup_Channels;
  352.         ULONG    ahiup_AudioMode;
  353.         ULONG    ahiup_Frequency;
  354.         Fixed    ahiup_MonitorVolume;
  355.         Fixed    ahiup_InputGain;
  356.         Fixed    ahiup_OutputVolume;
  357.         ULONG    ahiup_Input;
  358.         ULONG    ahiup_Output;
  359. };
  360.  
  361. struct AHIGlobalPrefs
  362. {
  363.     UWORD    ahigp_DebugLevel;            /* Range: 0-3 (for None, Low,
  364.                                High and All) */
  365.     BOOL    ahigp_DisableSurround;
  366.     BOOL    ahigp_DisableEcho;
  367.     BOOL    ahigp_FastEcho;
  368.     Fixed    ahigp_MaxCPU;
  369.     BOOL    ahigp_ClipMasterVolume;
  370. };
  371.  
  372.  /* Debug levels */
  373. #define AHI_DEBUG_NONE        (0)
  374. #define AHI_DEBUG_LOW        (1)
  375. #define AHI_DEBUG_HIGH        (2)
  376. #define AHI_DEBUG_ALL        (3)
  377.  
  378.  /* AHIRequest */
  379.  
  380. struct AHIRequest
  381. {
  382.     struct    IOStdReq     ahir_Std;        /* Standard IO request */
  383.     UWORD             ahir_Version;        /* Needed version */
  384. /* --- New for V4, they will be ignored by V2 and earlier --- */
  385.     UWORD             ahir_Pad1;
  386.     ULONG             ahir_Private[2];    /* Hands off! */
  387.     ULONG             ahir_Type;        /* Sample format */
  388.     ULONG             ahir_Frequency;    /* Sample/Record frequency */
  389.     Fixed             ahir_Volume;        /* Sample volume */
  390.     Fixed             ahir_Position;        /* Stereo position */
  391.     struct AHIRequest     *ahir_Link;        /* For double buffering */
  392. };
  393.  
  394.  /* Flags for OpenDevice() */
  395.  
  396. #define    AHIDF_NOMODESCAN    (1<<0)
  397. #define    AHIDB_NOMODESCAN    (0)
  398.  
  399. #endif /* DEVICES_AHI_H */
  400.